package com.cakemallproject.service.impl;

import com.cakemallproject.mapper.CartMapper;
import com.cakemallproject.pojo.mapperObj.Cart;
import com.cakemallproject.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartServiceImpl implements CartService {
    @Autowired
    private CartMapper cartMapper;

    @Override
    public List<Cart> list() {
        return cartMapper.list();
    }

    @Override
    public List<Cart> getCartByUid(Integer uid) {
        return cartMapper.getByUid(uid);
    }

    @Override
    public void insert(Cart cart) {
        cartMapper.insert(cart);
    }

    @Override
    public List<Cart> getCartListByCid(List<Integer> cartIds) {
        System.out.println("cartIds = " + cartIds);
        return cartMapper.getCartListByCid(cartIds);
    }

    @Override
    public void delete(List<Integer> cartIds) {
        cartMapper.delete(cartIds);
    }

    @Override
    public void updateCart(Cart cart) {
        cartMapper.update(cart);
    }
}
